package com.open.capacity.finance.dto;

import lombok.Data;

import java.math.BigDecimal;

/**
 * 三栏明细账
 */
@Data
public class SlmxzDto implements Comparable {

    public Integer tag;
    public String pzid;
    public String pzrq;
    public Integer flxh;
    public Integer kjqj;
    public String pzh;
    public String zy;
    public String kmCode;
    public String kmName;
    public String ajName;
    public String pjhName;
    public String zphName;
    public String wldxName;
    public String bmName;
    public String xmName;

    public Integer yefx;
    public String yefxStr;

    public String getYefxStr() {
        if (yefx != null) {
            switch (yefx) {
                case 0:
                    return "平";
                case 1:
                    return "借";
                case 2:
                    return "贷";
                default:
                    return "借";
            }
        } else {
            return "";
        }
    }

    public BigDecimal j;
    public BigDecimal d;
    public BigDecimal ye;

    @Override
    public int compareTo(Object o) {
        SlmxzDto s = (SlmxzDto) o;
        if (this.pzrq.compareTo(s.pzrq) < 0) {
            return -1;
        } else if (this.pzrq.compareTo(s.pzrq) > 0) {
            return 1;
        } else if (this.pzrq.compareTo(s.pzrq) == 0 && this.tag < s.getTag()) {
            return -1;
        } else if (this.pzrq.compareTo(s.pzrq) == 0 && this.tag > s.getTag()) {
            return 1;
        } else if (this.pzrq.compareTo(s.pzrq) == 0 && this.tag == s.getTag() && this.getPzh().compareTo(s.getPzh()) > 0) {
            return 1;
        } else if (this.pzrq.compareTo(s.pzrq) == 0 && this.tag == s.getTag() && this.getPzh().compareTo(s.getPzh()) < 0) {
            return -1;
        } else if (this.pzrq.compareTo(s.pzrq) == 0 && this.tag == s.getTag() && this.getPzh().compareTo(s.getPzh()) == 0 && this.getFlxh() > s.getFlxh()) {
            return 1;
        } else if (this.pzrq.compareTo(s.pzrq) == 0 && this.tag == s.getTag() && this.getPzh().compareTo(s.getPzh()) == 0 && this.getFlxh() < s.getFlxh()) {
            return -1;
        } else if (this.pzrq.compareTo(s.pzrq) > 0) {
            return 1;
        } else {
            if (this.pzrq.compareTo(s.pzrq) == 0 && this.tag == s.getTag() && this.getPzh().compareTo(s.getPzh()) == 0 && this.getFlxh() == s.getFlxh()) {
                return 0;
            } else {
                return -1;
            }
        }
    }
}
